package sdk

import "fmt"

// 模拟微信支付sdk

// WeChatPayClient 微信支付原生客户端
type WeChatPayClient struct {
	MchID  string
	APIKey string
}

// WeChatPayRequest 微信支付原生请求
type WeChatPayRequest struct {
	AppID          string  `json:"appid"`
	MchID          string  `json:"mch_id"`
	OutTradeNo     string  `json:"out_trade_no"`
	TotalFee       float64 `json:"total_fee"`
	Body           string  `json:"body"`
	NotifyURL      string  `json:"notify_url"`
	TradeType      string  `json:"trade_type"`
	SpbillCreateIP string  `json:"spbill_create_ip"`
}

// WeChatPayResponse 微信支付原生响应
type WeChatPayResponse struct {
	ReturnCode   string `json:"return_code"`
	ReturnMsg    string `json:"return_msg"`
	ResultCode   string `json:"result_code"`
	PrepayID     string `json:"prepay_id"`
	ErrorCode    string `json:"err_code"`
	ErrorCodeDes string `json:"err_code_des"`
}

// ProcessWeChatPayment 处理微信支付
func (c *WeChatPayClient) ProcessWeChatPayment(req WeChatPayRequest) (*WeChatPayResponse, error) {
	// 模拟实际调用微信支付接口
	fmt.Printf("调用微信支付接口: %+v\n", req)

	return &WeChatPayResponse{
		ReturnCode: "SUCCESS",
		ResultCode: "SUCCESS",
		PrepayID:   "WX" + req.OutTradeNo,
	}, nil
}
